<?php
declare (strict_types = 1);
namespace app\api\model;

class UserReply extends Base
{
    /**
	 * 修改一条数据
	 * @param int $uid:会员ID
	 * @return array|false
	 */
	public function edit_one_data($robotId,$data)
	{
	   
		$data=json_decode($data,true);
		$data=$data['reply'];
		dump($data);
		$user = $this->where('robot_id',$robotId)->where('uid',session('admin.id'))->find();
		//判断数据
        if($user){
            //有找到
            $data['robot_id']=$robotId;
            $res=$this->update($data,['id'=>$user['id']]);
            return $res ? ['code' => 1, 'msg' => '更新文案成功'] : ['code' => 0, 'msg' => '更新文案失败'];
        }else {
            //没有找到
            return ['code'=>0,'msg'=>'提交参数异常'];
        }
	}
	
	/**
	 * 获取一条数据
	 * @param int $uid:会员ID
	 * @return array|false
	 */
	public function get_datas($robotId,$configreName)
	{
        return $this->where('robot_id',$robotId)->find();

	    if($configreName=='mia555nDan'){
            if($robotId=='robotAll'){
    		   $robotId='gh_80bb762dd2d9';
		    }
	        return $this->where('robot_id',$robotId)->field('card_title,card_cover,card_content,card_append')->find();
	    }elseif ($configreName=='fan555Li') {
	        $robotId='gh_80bb762dd2d9';
	        return $this->where('robot_id',$robotId)->find();
	    }else{
	        return $this->where('robot_id',$robotId)->find();
	    }

	    
	}
	
    
}